package com.itheima.day2staticcodeblock;

import java.util.ArrayList;

public class StaticCodeBlock {
    //这就是静态代码块，属于类，与类一起优先加载一次，自动触发执行
    //顶一个静态Arraylist 存储54张牌，加载一次
    // 程序执行main方法钱，把54张牌放进去
    public static ArrayList<String> cards = new ArrayList<>();
    static {
        //当明确了类型和数量，用数组
        String[] sizes = {"3","4","5","6","7","8","9","10","J","Q","K","A","2"};
        String[] color = {"♥","♣","♦","♠"};
        for (int i = 0; i < sizes.length; i++) {
            for (int j = 0; j < color.length; j++) {
                String card = sizes[i]+color[j];
                cards.add(card);
            }
        }
        //单独加大小王
        cards.add("小🃏");
        cards.add("大🃏");
    }

    public static void main(String[] args) {
        System.out.println("新牌:"+cards);
    }
}
